using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._GeocodingTools
{
    /// <summary>
    /// <para>Geocode Addresses</para>
    /// <para>Geocodes a table of addresses.  This process requires a table that stores the addresses you want to geocode and an address locator or a composite address locator. This  tool matches the addresses against the locator and saves the result for each input record  in a new point feature class.  When using the ArcGIS World Geocoding Service, this operation may consume credits.</para>
    /// <para>对地址表进行地理编码。 此过程需要一个用于存储要进行地理编码的地址的表，以及一个地址定位器或复合地址定位器。此工具可将地址与定位器进行匹配，并将每个输入记录的结果保存在新的点要素类中。 使用 ArcGIS World Geocoding Service 时，此操作可能会消耗配额。</para>
    /// </summary>    
    [DisplayName("Geocode Addresses")]
    public class GeocodeAddresses : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public GeocodeAddresses()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para>The table of addresses to geocode.</para>
        /// <para>要进行地理编码的地址表。</para>
        /// </param>
        /// <param name="_address_locator">
        /// <para>Input Address Locator</para>
        /// <para><xdoc>
        ///   <para>The address locator to use to geocode the table of addresses.
        ///   <para>Including the .loc extension after the locator name at the end of the locator path is optional.</para>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>用于对地址表进行地理编码的地址定位器。
        ///   <para>在定位器路径末尾的定位器名称后包含 .loc 扩展名是可选的。</para>
        ///   </para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_in_address_fields">
        /// <para>Input Address Fields</para>
        /// <para><xdoc>
        ///   <para>The mapping of address fields used by the address locator to fields in the input table of addresses. Select Single Field if the complete address is stored in one field in the input table, for example, 303 Peachtree St NE, Atlanta, GA 30308. Select Multiple Fields if the input addresses are split into multiple fields such as Address, City, State, and ZIP for a general United States address.</para>
        ///   <para>Some locators support multiple input addresses fields, such as Address, Address2, and Address3. In this case, the address component can be separated into multiple fields, and the address fields will be concatenated at the time of geocoding. For example, 100, Main st, and Apt 140 across three fields, or 100 Main st and Apt 140 across two fields, both become 100 Main st Apt 140 when geocoding.</para>
        ///   <para>If you choose not to map an optional input address field used by the address locator to a field in the input table of addresses, specify that there is no mapping using <None> in place of the field name.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>地址定位器使用的地址字段到地址输入表中的字段的映射。如果完整地址存储在输入表中的一个字段中，请选择“单个字段”，例如，303 Peachtree St NE， Atlanta， GA 30308。如果输入地址拆分为多个字段，例如美国通用地址的地址、城市、州和 ZIP，请选择多个字段。</para>
        ///   <para>某些定位器支持多个输入地址字段，例如地址、地址 2 和地址 3。在这种情况下，地址组件可以分成多个字段，并且地址字段将在地理编码时连接起来。例如，地理编码时，跨三个字段的 100、Main st 和 Apt 140，或跨两个字段的 100 Main st 和 Apt 140，都变为 100 Main st Apt 140。</para>
        /// <para>如果选择不将地址定位器使用的可选输入地址字段映射到地址输入表中的字段，请指定不使用 <None> in 代替字段名称进行映射。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_out_feature_class">
        /// <para>Output Feature Class</para>
        /// <para>The output geocoded feature class or shapefile.</para>
        /// <para>输出地理编码要素类或 shapefile。</para>
        /// </param>
        public GeocodeAddresses(object _in_table, object _address_locator, object _in_address_fields, object _out_feature_class)
        {
            this._in_table = _in_table;
            this._address_locator = _address_locator;
            this._in_address_fields = _in_address_fields;
            this._out_feature_class = _out_feature_class;
        }
        public override string ToolboxName => "Geocoding Tools";

        public override string ToolName => "Geocode Addresses";

        public override string CallName => "geocoding.GeocodeAddresses";

        public override List<string> AcceptEnvironments => ["configKeyword", "outputCoordinateSystem"];

        public override object[] ParameterInfo => [_in_table, _address_locator, _in_address_fields, _out_feature_class, _out_relationship_type.GetGPValue(), _country, _location_type.GetGPValue(), _category, _output_fields.GetGPValue()];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The table of addresses to geocode.</para>
        /// <para>要进行地理编码的地址表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Input Address Locator</para>
        /// <para><xdoc>
        ///   <para>The address locator to use to geocode the table of addresses.
        ///   <para>Including the .loc extension after the locator name at the end of the locator path is optional.</para>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>用于对地址表进行地理编码的地址定位器。
        ///   <para>在定位器路径末尾的定位器名称后包含 .loc 扩展名是可选的。</para>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Address Locator")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _address_locator { get; set; }


        /// <summary>
        /// <para>Input Address Fields</para>
        /// <para><xdoc>
        ///   <para>The mapping of address fields used by the address locator to fields in the input table of addresses. Select Single Field if the complete address is stored in one field in the input table, for example, 303 Peachtree St NE, Atlanta, GA 30308. Select Multiple Fields if the input addresses are split into multiple fields such as Address, City, State, and ZIP for a general United States address.</para>
        ///   <para>Some locators support multiple input addresses fields, such as Address, Address2, and Address3. In this case, the address component can be separated into multiple fields, and the address fields will be concatenated at the time of geocoding. For example, 100, Main st, and Apt 140 across three fields, or 100 Main st and Apt 140 across two fields, both become 100 Main st Apt 140 when geocoding.</para>
        ///   <para>If you choose not to map an optional input address field used by the address locator to a field in the input table of addresses, specify that there is no mapping using <None> in place of the field name.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>地址定位器使用的地址字段到地址输入表中的字段的映射。如果完整地址存储在输入表中的一个字段中，请选择“单个字段”，例如，303 Peachtree St NE， Atlanta， GA 30308。如果输入地址拆分为多个字段，例如美国通用地址的地址、城市、州和 ZIP，请选择多个字段。</para>
        ///   <para>某些定位器支持多个输入地址字段，例如地址、地址 2 和地址 3。在这种情况下，地址组件可以分成多个字段，并且地址字段将在地理编码时连接起来。例如，地理编码时，跨三个字段的 100、Main st 和 Apt 140，或跨两个字段的 100 Main st 和 Apt 140，都变为 100 Main st Apt 140。</para>
        /// <para>如果选择不将地址定位器使用的可选输入地址字段映射到地址输入表中的字段，请指定不使用 <None> in 代替字段名称进行映射。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Address Fields")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_address_fields { get; set; }


        /// <summary>
        /// <para>Output Feature Class</para>
        /// <para>The output geocoded feature class or shapefile.</para>
        /// <para>输出地理编码要素类或 shapefile。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Feature Class")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_feature_class { get; set; }


        /// <summary>
        /// <para>Dynamic Output Feature Class</para>
        /// <para>This parameter is always disabled in ArcGIS Pro. It remains to support backward compatibility with ArcGIS Desktop.</para>
        /// <para>此参数在 ArcGIS Pro 中始终处于禁用状态。它仍然支持与 ArcGIS Desktop 的向后兼容性。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Dynamic Output Feature Class")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _out_relationship_type_value _out_relationship_type { get; set; } = _out_relationship_type_value._false;

        public enum _out_relationship_type_value
        {
            /// <summary>
            /// <para>DYNAMIC</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DYNAMIC")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>STATIC</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("STATIC")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Country</para>
        /// <para><xdoc>
        ///   <para>This parameter is available for locators that support a country parameter and will limit geocoding to the selected countries. Making a country selection will improve the accuracy of geocoding in most cases. If a field representing countries in the Input Table is mapped to the Country field in Input Address Fields, the country value from the Input Table will override the Country parameter.</para>
        ///   <para>This is limited to the selected country or countries. When no country is specified, geocoding is performed against all supported countries of the locator.</para>
        ///   <para>Country is not supported for all locators.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>此参数可用于支持国家/地区参数的定位器，并将地理编码限制为所选国家/地区。在大多数情况下，选择国家/地区将提高地理编码的准确性。如果表示输入表中国家/地区的字段映射到输入地址字段中的国家/地区字段，则输入表中的国家/地区值将覆盖国家/地区参数。</para>
        ///   <para>这仅限于选定的一个或多个国家/地区。如果未指定国家/地区，则对定位器支持的所有国家/地区执行地理编码。</para>
        ///   <para>并非所有定位器都支持国家/地区。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Country")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _country { get; set; } = null;


        /// <summary>
        /// <para>Preferred Location Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the preferred output geometry for PointAddress matches. The options for this parameter are Routing location, the side of street location, which can be used for routing, or Address location, the location that represents the rooftop or parcel centroid for the address. If the preferred location does not exist in the data, the default location will be returned instead. For geocode results with Addr_type=PointAddress, the x,y attribute values describe the coordinates of the address along the street, while the DisplayX and DisplayY values describe the rooftop, or building centroid, coordinates.</para>
        ///   <para>This parameter is not supported for all locators.</para>
        ///   <bulletList>
        ///     <bullet_item>Address location—Geometry for geocode results that represent an address location such as rooftop location, parcel centroid, or front door is returned.</bullet_item><para/>
        ///     <bullet_item>Routing location—Geometry for geocode results that represent a location close to the side of the street, which can be used for vehicle routing, is returned. This is the default.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定 PointAddress 匹配的首选输出几何图形。此参数的选项包括路径位置（街道位置的一侧，可用于路径规划）或地址位置（表示地址的屋顶或宗地质心的位置）。如果数据中不存在首选位置，则将改为返回默认位置。对于具有 Addr_type=PointAddress 的地理编码结果，x，y 属性值描述沿街道的地址坐标，而 DisplayX 和 DisplayY 值描述屋顶或建筑物质心坐标。</para>
        ///   <para>并非所有定位器都支持此参数。</para>
        ///   <bulletList>
        ///     <bullet_item>地址位置 - 返回表示地址位置（如屋顶位置、宗地质心或前门）的地理编码结果的几何。</bullet_item><para/>
        ///     <bullet_item>路径定位 - 返回表示靠近街道一侧的位置（可用于车辆路径）的地理编码结果的几何图形。这是默认设置。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Preferred Location Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _location_type_value _location_type { get; set; } = _location_type_value._ROUTING_LOCATION;

        public enum _location_type_value
        {
            /// <summary>
            /// <para>Routing location</para>
            /// <para>Routing location—Geometry for geocode results that represent a location close to the side of the street, which can be used for vehicle routing, is returned. This is the default.</para>
            /// <para>路径定位 - 返回表示靠近街道一侧的位置（可用于车辆路径）的地理编码结果的几何图形。这是默认设置。</para>
            /// </summary>
            [Description("Routing location")]
            [GPEnumValue("ROUTING_LOCATION")]
            _ROUTING_LOCATION,

            /// <summary>
            /// <para>Address location</para>
            /// <para>Address location—Geometry for geocode results that represent an address location such as rooftop location, parcel centroid, or front door is returned.</para>
            /// <para>地址位置 - 返回表示地址位置（如屋顶位置、宗地质心或前门）的地理编码结果的几何。</para>
            /// </summary>
            [Description("Address location")]
            [GPEnumValue("ADDRESS_LOCATION")]
            _ADDRESS_LOCATION,

        }

        /// <summary>
        /// <para>Category</para>
        /// <para><xdoc>
        ///   <para>Limits the types of places the locator searches, which eliminates false positive matches and potentially speeds up the search process. When no category is used, geocoding is performed against all supported categories. Not all category values are supported for all locations and countries. In general, the parameter can be used for the following:
        ///   <bulletList>
        ///     <bullet_item>Limit matches to specific place types or address levels  </bullet_item><para/>
        ///     <bullet_item>Avoid fallback matches to unwanted address levels  </bullet_item><para/>
        ///     <bullet_item>Disambiguate coordinate searches  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>This parameter is not supported for all locators.</para>
        ///   <para>See the ArcGIS REST API web help for details about category filtering.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>限制定位器搜索的地点类型，从而消除误报匹配，并可能加快搜索过程。如果未使用任何类别，则会针对所有受支持的类别执行地理编码。并非所有地区和国家/地区都支持所有类别值。通常，该参数可用于以下用途：
        ///   <bulletList>
        ///     <bullet_item>将匹配限制为特定地点类型或地址级别</bullet_item><para/>
        ///     <bullet_item>避免回退匹配到不需要的地址级别</bullet_item><para/>
        ///     <bullet_item>消除坐标搜索的歧义</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>并非所有定位器都支持此参数。</para>
        ///   <para>有关类别过滤的详细信息，请参阅 ArcGIS REST API WEB 帮助。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Category")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _category { get; set; } = null;


        /// <summary>
        /// <para>Output Fields</para>
        /// <para><xdoc>
        ///   <para>Specifies which locator output fields are returned in the geocode results.</para>
        ///   <para>This parameter can be used with input locators created with the Create Locator tool or Create Feature Locator tool stored on disk or published to Enterprise 10.9 or later. Composite locators that contain at least one locator created with the Create Address Locator tool do not support this parameter.</para>
        ///   <bulletList>
        ///     <bullet_item>All— Includes all available locator output fields in the geocode results. This is the default.</bullet_item><para/>
        ///     <bullet_item>Location Only—Stores the Shape field in the geocode results. The original field names from the Input Table parameter are maintained with their original field names. Rematching geocode results is not available with this option.</bullet_item><para/>
        ///     <bullet_item>Minimal—Adds the following fields that describe the location and how well it matches to information in the locator in the geocode results: Shape, Status, Score, Match_type, Match_addr, and Addr_type. The original field names from the Input Table parameter are maintained with their original field names.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定在地理编码结果中返回的定位器输出字段。</para>
        ///   <para>此参数可用于使用创建定位器工具或创建要素定位器工具创建的输入定位器，这些工具存储在磁盘上或发布到 Enterprise 10.9 或更高版本。包含至少一个使用创建地址定位器工具创建的定位器的复合定位器不支持此参数。</para>
        ///   <bulletList>
        ///     <bullet_item>全部 - 在地理编码结果中包括所有可用的定位器输出字段。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>仅位置 - 将形状字段存储在地理编码结果中。输入表参数中的原始字段名称将与其原始字段名称一起保留。此选项不提供重新匹配地理编码结果。</bullet_item><para/>
        ///     <bullet_item>最小值 - 添加以下字段，用于描述位置及其与地理编码结果中定位器中信息的匹配程度：形状、状态、分数、Match_type、Match_addr和Addr_type。输入表参数中的原始字段名称将与其原始字段名称一起保留。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Fields")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _output_fields_value _output_fields { get; set; } = _output_fields_value._ALL;

        public enum _output_fields_value
        {
            /// <summary>
            /// <para>All</para>
            /// <para>All— Includes all available locator output fields in the geocode results. This is the default.</para>
            /// <para>全部 - 在地理编码结果中包括所有可用的定位器输出字段。这是默认设置。</para>
            /// </summary>
            [Description("All")]
            [GPEnumValue("ALL")]
            _ALL,

            /// <summary>
            /// <para>Minimal</para>
            /// <para>Minimal—Adds the following fields that describe the location and how well it matches to information in the locator in the geocode results: Shape, Status, Score, Match_type, Match_addr, and Addr_type. The original field names from the Input Table parameter are maintained with their original field names.</para>
            /// <para>最小值 - 添加以下字段，用于描述位置及其与地理编码结果中定位器中信息的匹配程度：形状、状态、分数、Match_type、Match_addr和Addr_type。输入表参数中的原始字段名称将与其原始字段名称一起保留。</para>
            /// </summary>
            [Description("Minimal")]
            [GPEnumValue("MINIMAL")]
            _MINIMAL,

            /// <summary>
            /// <para>Location Only</para>
            /// <para>Location Only—Stores the Shape field in the geocode results. The original field names from the Input Table parameter are maintained with their original field names. Rematching geocode results is not available with this option.</para>
            /// <para>仅位置 - 将形状字段存储在地理编码结果中。输入表参数中的原始字段名称将与其原始字段名称一起保留。此选项不提供重新匹配地理编码结果。</para>
            /// </summary>
            [Description("Location Only")]
            [GPEnumValue("LOCATION_ONLY")]
            _LOCATION_ONLY,

        }

        public GeocodeAddresses SetEnv(object configKeyword = null, object outputCoordinateSystem = null)
        {
            base.SetEnv(configKeyword: configKeyword, outputCoordinateSystem: outputCoordinateSystem);
            return this;
        }

    }

}